import {BEOLD} from './mutation_type'
const mutations = {
  // 添加购物车，数量+1
  addNum(state) {
    state.count ++;
  },
  // 充值,带有数据，可以将数据整理成一个对象
  chargeMoney(state, payload) {
    console.log(payload);
    if(payload.type === '$') {
      state.money += payload.num*7;
    }else {
      state.money += payload.num;
    }
  },
  // 对象风格的提交方式
  chargeMoneyObj(state, payload) {
    console.log(payload);
    if(payload.moneyType === '$') {
      state.money += payload.num*7;
    }else {
      state.money += payload.num;
    }
  },
  // 年龄长大一岁
  [BEOLD](state) {
    state.age ++
  },
  gotPoint(state, point) {
    state.point = point
  },
  gotLevel(state, level) {
    state.level = level
  }
}

export default mutations